<template>
  <div>
    <helloVue
      v-for="item in list"
      :key="item.id"
      :des="item.id"
      :price="item.proprice"
      :title="item.proname"
      :item="item"
      :count="count"
      :string="string"
      @kanjia="kanjia"
    ></helloVue>
  </div>
</template>

<script>
import helloVue from "./components/Hello.vue";
export default {
  name: "App",
  data() {
    return {
      count: 150,
      srting: "123",
      list: [
        { id: 1, proname: "超级好吃的棒棒糖", proprice: 18.8 },
        { id: 2, proname: "超级好吃的大鸡腿", proprice: 34.2 },
        { id: 3, proname: "超级无敌的冰激凌", proprice: 14.2 },
      ],
    };
  },
  methods: {
    kanjia(num, id) {
      // console.log("砍价");
      // console.log(num);
      // console.log(des);
      this.list.forEach((item) => {
        if (item.id === id) {
          item.proprice = item.proprice + num;
        }
      });
    },
  },
  components: {
    helloVue,
  },
};
</script>

<style></style>
